Skip to content

feat: investor implementation#77

Merged
JoelVR17 merged 3 commits intodevelopfrom
feature/implement-bk-investor
Mar 13, 2026
Merged

feat: investor implementation#77
JoelVR17 merged 3 commits intodevelopfrom
feature/implement-bk-investor

Conversation

@JoelVR17
Copy link
Contributor

@JoelVR17 JoelVR17 commented Mar 13, 2026

Summary by CodeRabbit

  • New Features

    • Claim ROI directly from investments with wallet signing and transaction submission
    • Live investments and campaigns fetched from backend APIs; invest flow now persists to backend
  • Improvements

    • Expanded campaign statuses (Draft, Fundraising, Active, Repayment, Claimable, Paused) and updated filters
    • Simplified campaign-based UI, clearer summaries, and user-facing toast notifications for success/errors
    • Centralized HTTP client for more consistent API interactions across apps

@JoelVR17 JoelVR17 self-assigned this Mar 13, 2026
@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
backoffice-tokenization Error Error Mar 13, 2026 9:56am
investor Ready Ready Preview, Comment Mar 13, 2026 9:56am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Warning

Rate limit exceeded

@JoelVR17 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b766f9a-07e3-44c1-9fb3-38f40bc94e54

📥 Commits

Reviewing files that changed from the base of the PR and between 9d11c1f and b19fa45.

📒 Files selected for processing (1)
  • apps/investor-tokenization/src/features/investments/hooks/useUserInvestments.hook.ts
📝 Walkthrough

Walkthrough

Adds a shared httpClient factory and app-specific clients, expands campaign status/types and API types, adds investor-focused investment endpoints, and refactors investor/backoffice apps to use real API data with wallet-integrated ROI claim and investment persistence flows.

Changes

Cohort / File(s) Summary
Shared HTTP client & exports
packages/shared/src/lib/httpClient.ts, packages/shared/src/index.ts, packages/shared/package.json
New createHttpClient factory and HttpClientOptions; re-exported httpClient entry added to package exports.
App HTTP clients & env
apps/backoffice-tokenization/src/lib/httpClient.ts, apps/investor-tokenization/src/lib/httpClient.ts, apps/backoffice-tokenization/.env.example, apps/investor-tokenization/.env.example
App-level httpClient instances created using NEXT_PUBLIC_CORE_API_URL and per-app API keys; .env.example updated (new NEXT_PUBLIC_BACKOFFICE_API_KEY / NEXT_PUBLIC_INVESTORS_API_KEY, unquoted values, trailing newline).
Core API: investments & infra
apps/core/src/investments/investments.controller.ts, apps/core/src/investments/investments.service.ts, apps/core/src/main.ts, apps/core/src/prisma/prisma.service.ts, apps/core/package.json
Added GET /investments/investor/:address and corresponding service method; dotenv import; CORS allow x-api-key; Prisma datasource URL normalization (buildDatasourceUrl()); added dotenv dependency.
Investor data services (httpClient migration)
apps/investor-tokenization/src/features/investments/services/investment.service.ts, apps/investor-tokenization/src/features/transparency/services/campaign.service.ts, apps/investor-tokenization/src/features/claim-roi/services/claim.service.ts, apps/investor-tokenization/src/features/tokens/services/token.service.ts
Services migrated from axios/local logic to shared httpClient; added fetchMyInvestments, createInvestment, fetchCampaigns; claim/token endpoints remapped to new request/response shapes.
Investor hooks & data flow
apps/investor-tokenization/src/features/investments/hooks/useUserInvestments.hook.ts
Hook now fetches InvestmentFromApi[] via fetchMyInvestments (replaces previous escrow/balance resolution logic).
Investor UI: investments & claim flow
apps/investor-tokenization/src/app/my-investments/page.tsx, apps/investor-tokenization/src/features/investments/InvestmentsView.tsx, apps/investor-tokenization/src/features/investments/components/InvestmentCard.tsx
Introduces wallet-integrated ROI claim flow (build XDR, sign, submit), replaces mocked campaigns with API-driven investments, and refactors InvestmentCard/InvestmentsView to consume InvestmentFromApi shape.
Investor UI: projects & dialogs
apps/investor-tokenization/src/features/transparency/ProjectList.tsx, apps/investor-tokenization/src/features/transparency/ProjectCard.tsx, apps/investor-tokenization/src/features/tokens/components/InvestDialog.tsx, apps/investor-tokenization/src/components/ui/apple-cards-carousel.tsx, apps/investor-tokenization/src/features/tokens/context/SelectedEscrowContext.tsx
ProjectList/ProjectCard now driven by CampaignFromApi; InvestDialog persists investments via createInvestment and uses toast-based feedback; SelectedEscrowContext/Apple cards threaded with optional campaignId.
Campaign types, statuses & mocks
apps/investor-tokenization/src/features/roi/types/campaign.types.ts, apps/investor-tokenization/src/features/roi/constants/campaign-status.ts, apps/investor-tokenization/src/features/roi/components/campaign-filter.tsx, apps/investor-tokenization/src/features/roi/data/mock-campaigns.ts, apps/investor-tokenization/src/features/transparency/types.ts
Expanded CampaignStatus (DRAFT, FUNDRAISING, ACTIVE, REPAYMENT, CLAIMABLE, PAUSED, CLOSED); added CampaignFromApi and vaultId fields; updated status config, filters, and mock data to match new lifecycle.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Page as my-investments Page
    participant ClaimService as ClaimROI Service
    participant Wallet as Wallet Context
    participant SignService as Wallet Signing
    participant SendService as SendTransaction Service
    participant Toast as Toast Notification

    User->>Page: Click "Claim ROI"
    Page->>ClaimService: createClaimROI(vaultId, callerAddress)
    ClaimService-->>Page: { xdr, success, message }
    Page->>Wallet: get wallet address
    Wallet-->>Page: walletAddress
    Page->>SignService: signXDR(xdr, wallet)
    SignService-->>Page: signedXdr
    Page->>SendService: submitTransaction(signedXdr)
    SendService-->>Page: { hash }
    Page->>Toast: show success(hash)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • armandocodecr
  • zkCaleb-dev

Poem

🐰 I hopped from mock to real API,

where campaigns wake and statuses fly,
httpClient built, keys set in place,
wallets sign — transactions race,
a tiny rabbit cheers: "Claim away!" 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'feat: investor implementation' is vague and overly broad, using a generic term 'implementation' that fails to convey the specific purpose or main change of this extensive changeset covering multiple features and services. Use a more specific title that highlights the primary feature or change, such as 'feat: add investor ROI claiming and campaign viewing flow' or 'feat: integrate investments API with wallet-based ROI claims'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/implement-bk-investor
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JoelVR17 JoelVR17 merged commit 0c1a804 into develop Mar 13, 2026
2 of 3 checks passed
This was referenced Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants